package com.lx.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

public class PageResult<T> {
	@Schema(description = "总条数")
	private Long total;

	@Schema(description = "返回的数据")
	private List<T> rows;

	@Schema(description = "第几页",required = true)
	private Long current;

	@Schema(description = "查询条数",required = true)
	private Long size;

    @Schema(description = "总页数", required = true)
    private Long pages;

	public PageResult() {}

    public PageResult(IPage page) {
	    this(page.getTotal(), page.getRecords(),page.getCurrent(),page.getSize(),page.getPages());
    }
    public PageResult(Long total, List<T> rows, Long current, Long size, Long pages) {
        this.total = total;
        this.rows = rows;
        this.current = current;
        this.size = size;
        this.pages = pages;
    }

    public Long getCurrent() {
        return current;
    }

    public void setCurrent(Long current) {
        this.current = current;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    public Long getTotal() {
		return total;
	}
	public void setTotal(Long total) {
		this.total = total;
	}
	public List<T> getRows() {
		return rows;
	}
	public void setRows(List<T> rows) {
		this.rows = rows;
	}



}
